package com.cn.xact.ty_treasured_book.activity;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import com.cn.xact.ty_treasured_book.R;
import com.cn.xact.ty_treasured_book.R.layout;
import com.cn.xact.ty_treasured_book.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.Menu;
import android.view.Window;
import android.widget.ImageView;

public class ScaledImageActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_scaled_image);

        ImageView image = (ImageView)findViewById(R.id.scaled_image);
        String picPath = getIntent().getExtras().getString("image");
        try {
            image.setImageBitmap(BitmapFactory.decodeStream(new FileInputStream(picPath)));
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.scaled_image, menu);
        return true;
    }

}
